﻿#include<iostream>
using namespace std;

template<typename T>
void Swap(T& a, T& b) {
	T tmp{ a };
	a = b;
	b = tmp;
}

template<typename T>
void Sort(T* ary, unsigned count, bool BigSort = true) {
	for (unsigned i = 1; i < count; i++) {
		for (unsigned i = 1; i < count; i++) {
			bool bcase = BigSort ? ary[i] > ary[i - 1]:ary[i] < ary[i - 1];
			if (bcase) Swap(ary[i], ary[i - 1]);
		}
	}
}

int main() {
	int a[5]{ 123,145,534,685,3456 };
	short a1[5]{ 123,145,534,685,3456 };

	string a2[5]{ "sadf","124","cxb","b23","234b" };

	Sort(a1, 5);
	Sort(a, 5);
	Sort(a2, 5);

	for (auto x : a)cout << x << endl;
	for (auto x : a1)cout << x << endl;
	for (auto x : a2)cout << x << endl;
}